<template>
  <div class="client-select">
    <a-select
      show-search
      placeholder="选择客户"
      option-filter-prop="children"
      style="width: 100%"
      :filter-option="filterOption"
      @change="handleChange"
    >
      <a-select-option v-for="item in options" :key="item.id" :value="item.id">
        {{item.id}} - {{item.name}}
      </a-select-option>
    </a-select>
  </div>
</template>

<script>
// 输入客户姓名或客户ID的一部分或全部，返回完整客户姓名和客户ID的组合

export default {
  name: "ClientSelect",
  props: {

  },
  data() {
    return {
      data: [],
      value: '',
    };
  },
  computed: {
    options() {
      return this.$store.state.clientsCache;
    }
  },
  mounted() {
  },
  watch: {

  },
  methods: {
    handleChange(value) {
      this.value = value;
    },
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
  },
  components: {

  },
};
</script>

<style scoped lang="scss">

</style>
